package com.chixing.controller;

import com.chixing.pojo.Car;
import com.chixing.service.RecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RecommendController {

    @Autowired
    private RecommendService recommendService;

    /**
     * 基于用户的推荐
     * @param userId
     * @param num
     * @return
     */
    @GetMapping("recommendByUser")
    public List<Car> getRecommendProductByUser(@RequestParam("userId") Integer userId, @RequestParam("num")  int num){
        return recommendService.getRecommentProductByUser(userId,num);

    }
    /**
     * 基于内容的推荐
     * @param userId
     * @param num
     * @return
     */
    @GetMapping("recommendByProduct")
    public List<Car> getRecommendProductByProduct(@RequestParam("userId")Integer userId,@RequestParam("proId")Integer proId ,@RequestParam("num")int num){
        return recommendService.getRecommentProductByProduct(userId,proId,num);
    }


}